<template>
	<view class="content">
		<u-navbar bgColor="transparent" titleStyle="color:#fff" title="转赠记录" leftIconColor="#fff" :autoBack="true"
			:placeholder="false">
		</u-navbar>
		<view class="content-top">
			<view style="height: 124rpx;"></view>
		</view>
		<view class="content-box">
			<view class="income-cont" v-for="(item,index) in list" :key="index">
				<view class="income-left">
					<view class="income-text">
						{{item.message || '无记录名称'}}
					</view>
					<view class="time">
						{{$u.timeFormat(item.time, 'yyyy/mm/dd hh:MM:ss')}}
					</view>
				</view>
			</view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				list:[],
				status: 'loadmore',
			}
		},
		onLoad() {
			this.getRecord()
		},
		onReachBottom() {
			this.page ++ 
			this.status = 'loading'
			this.getRecord()
		},
		methods: {
			getRecord(){
				let params = {
					page:this.page,
					 type: 9,
				}
				this.$Request({
					method: 'POST',
					url: '/api/trade/gongcardLog',
					data: params
				}).then(res => {
					if (res.code == 1) {
						if(res.data.list.length < 10){
							this.status = 'nomore'
						}
						if(this.page == 1){
							this.list = res.data.list
						}else{
							this.list = [...this.list,...res.data.list]
						}
					}else {
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content-top {
		width: 100%;
		height: 200rpx;
		background: linear-gradient(90deg, #513AFD 0%, #F42FF9 54%, #F85B9F 100%);
	}

	.content-box {
		margin-top: -80rpx;
		padding: 30rpx;
		min-height: 92.5vh;
		background-color: #250F5A;
		border-top-right-radius: 30rpx;
		border-top-left-radius: 30rpx;

		.income-cont {
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: #fff;
			padding-bottom: 30rpx;
			border-bottom: 1rpx solid rgba(255, 255, 255, 0.5);
			margin-bottom: 30rpx;

			.income-left {
				.income-text {
					font-size: 32rpx;
					font-weight: 600;
				}

				.time {
					font-size: 24rpx;
					margin-top: 15rpx;
					color: #999;
				}
			}

			.income-num {
				font-size: 32rpx;
				font-weight: 600;
			}
		}
	}
</style>